package zhr.chapter12;

public class MyThread extends Thread{
    int i=0;
    public void run(){
        System.out.println("启动线程开始运行"+Thread.currentThread().getName());
        while (true){
            System.out.println("运行线程"+Thread.currentThread().getName()+",输出i的值："+i);
            try{
                Thread.sleep(10);
            }catch (InterruptedException e){
                System.out.println(e.getMessage());
            }
            if(i==4)break;
            i++;
        }
        System.out.println(Thread.currentThread().getName()+"运行结束");
    }
}
